if (!sessionStorage.getItem('big-event')) {
  location.href = './login.html'
}
//获取个人信息

async function reqGetInfo() {
  const res = await GetUserInfo()
  const {
    data: { nickname, user_pic, username },
  } = res.data
  // console.log(res)
  if (user_pic === null) {
    let fristBig = username[0].toUpperCase()
    $('.avatar').text(fristBig).css('display', 'inline-block')
  } else {
    $('.avatar').hide()
    $('.layui-nav-img').attr('src', user_pic).show()
  }
  if (nickname == '') {
    nickname = username
  }
  $('.username').text(nickname)
}
reqGetInfo()
//点击退出按钮事件
$('#logout').on('click', function () {
  layer.confirm('确认退出吗?', { icon: 3, title: '提示' }, function () {
    sessionStorage.removeItem('big-event')
    location.href = './login.html'
  })
})
